<?php $this->_extends('_layouts/default_layout'); ?>
 
<?php $this->_block('contents'); ?>

<table cellpadding="0" cellspacing="0" width="100%">
<tr><td class="box-top-left"></td><td class="box-top-cen"></td><td class="box-top-right"></td></tr>
<tr><td class="box-main-left"></td><td>
<h3>添加栏目</h3>
<div class="text">
<form action="<?php echo url('channel/add'); ?>" method="post" name="mainform" >
	<table cellpadding="0" id="ParamConf" name="ParamConf" cellspacing="0" width="100%">
	<tbody class="">
		<tr class="tth">
		<td width="*">栏目名称</td>
	</tr>
		<tr>
		<td><input class="input" type="text" value="" name="channelname[]" id="1011" size="45" /></td>
	</tr> 
		<tr>
		<td><input class="input" type="text" value="" name="channelname[]" id="1012" size="45" /></td>
	</tr>

	</tbody>
	</table>
	<table cellpadding="0" id="btn" name="btn" cellspacing="0" width="100%">
	<tr>
		<td class="tbutton" colspan="6"><input type="submit" value="提交" class="btn" name="sby" onclick="return (CheckIsNull())"></td><span style="aligh:right"><a href="javascript:addParamConf();"> 增加录入</a></span></td>
	</tr>
	</table>
</form>
</table>
<script type="text/javascript"> 
var index; 
index = 0; 

//新增一条参数信息 
function addParamConf(){ 
  s1 = "<input name='channelname[]' class='input' id='1011"+index+"' dataType='Require' msg='参数名称不允许为空' type='text'  size='45'  value=''>"; 
  s4 = "<a href=javascript:deleteParamConf('"+index+"')>删除</a>"; 
  arow = ParamConf.insertRow(); 
  arow.id="ParamConf"+index; 
  c1 = arow.insertCell(); 
  c1.align="left"; 
  c1.className='td_rb'; 
  c1.innerHTML=s1; 
    
  c4 = arow.insertCell(); 
  c4.align="left"; 
  c4.className='td_rb'; 
  c4.innerHTML=s4; 
  
  index = index+1; 
   //window_resize(); 
//initWindow(true); 
} 
//删除行 
function deleteParamConf(index){ 
	    var nameinput = document.getElementById("1011"+index);
		if(nameinput.value != "")
        {
		  if(window.confirm('确定要删除这条记录吗?')){ 
				ParamConf.deleteRow(document.getElementById("ParamConf"+index).rowIndex); 

				this.index = this.index - 1; 
		  } 
	    }
		else
		{
			ParamConf.deleteRow(document.getElementById("ParamConf"+index).rowIndex); 

			this.index = this.index - 1; 
		}
} 
function CheckIsNull()
{ 
    var name0_input = document.getElementById("1011");
	if(name0_input!= null && name0_input.value != "")
	{
		return true;
	}
    var name1_input = document.getElementById("1012");
	if(name1_input!= null && name1_input.value != "")
	{
		return true;
	}
	for(i=0; i<index; i++)
	{
	    var name_input = document.getElementById("1011"+i);
		if(name_input!= null && name_input.value != "")
		{
			return true;
		}
	}
    alert("请输入栏目内容");
	return false;
}
function GetLastIndex()
{
	return this.index;
}
</script> 

<?php $this->_endblock(); ?>